package com.li.springbootproject.controller.user;

import com.li.springbootproject.domain.common.BackResult;
import com.li.springbootproject.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description：
 * @Author：LiDong
 * @Create：2021/3/15
 * @Version：1.0.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 批量插入
     * @return
     */
    @RequestMapping("/insertbatch")
    public Object insertUserBatch() {
        return userService.insertUserBatch();
    }

    /**
     * in 超过 1000 条使用
     * @return
     */
    @PostMapping("/usein")
    public BackResult inSqlUse() {
        return userService.inSqlUse();
    }

    @GetMapping("/test")
    public BackResult test(){
        return userService.testDatasource();
    }

    /**
     * Event 使用
     * @return
     */
    @RequestMapping("/eventtest")
    public BackResult testEvent() {
        return userService.testEvent();
    }

}
